
 
layui.define(['form', 'upload'], function(exports){
  var $ = layui.$
  ,layer = layui.layer
  ,laytpl = layui.laytpl
  ,setter = layui.setter
  ,view = layui.view
  ,admin = layui.admin
  ,form = layui.form
  ,upload = layui.upload;

  var $body = $('body');
  
  //上传logo
  var logoSrc = $('#logo');
  upload.render({
    url: '/usercp/upload/upload'
    ,elem: '#LAY_logoUpload'
    ,field: 'file'
    ,done: function(res){
      if(res.code == 200){
        logoSrc.val(res.data);
      } else {
        layer.msg(res.msg, {icon: 5});
      }
    }
  });
  
  //查看logo
  admin.events.logoPreview = function(othis){
    var src = logoSrc.val();
    layer.photos({
      photos: {
        "title": "查看logo" //相册标题
        ,"data": [{
          "src": src //原图地址
        }]
      }
      ,shade: 0.01
      ,closeBtn: 1
      ,anim: 5
    });
  };  

  //对外暴露的接口
  exports('site/edit', {});
});